package com.neu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neu.mapper.UserMapper;
import com.neu.pojo.User;
import com.neu.util.IDUtil;

@Service
public class UserServiceImpl implements UserService {
	@Autowired
	private UserMapper userMapper;

	@Override
	public List<User> findAllUser(String userName) {
		return userMapper.findAllUser(userName);
	}

	@Override
	public User findUserById(String id) {
		return userMapper.findUserById(id);
	}

	@Override
	public User checkUserExists(User user) {
		return userMapper.checkUserExists(user);
	}

	@Override
	public int checkUserNameExists(User user) {
		return userMapper.checkUserNameExists(user);
	}
	
	@Override
	public int insertUser(User user) {
		user.setId(IDUtil.getID());
		return userMapper.insertUser(user);
	}

	@Override
	public int updateUser(User user) {
		return userMapper.updateUser(user);
	}

	@Override
	public int deleteUser(String id) {
		return userMapper.deleteUser(id);
	}
}
